package com.young.coderule.common.scan;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

/**
 * @DESCRIPTION: 编码规则资源工厂，用来存储开启了编码规则的实体，方便前端配置
 * @USER: Young
 * @DATE: 2022/7/29 9:53
 */
public class CodeRuleResourceFactory {

    private Map<String, ResourceDefinition> resourceMaps = new ConcurrentHashMap<>();

    public void mapResource(String code, ResourceDefinition resourceDefinition) {
        resourceMaps.put(code,resourceDefinition);
    }

    public List<ResourceDefinition> getCodeRuleResourceDefinition(){
        return resourceMaps.values().stream().collect(Collectors.toList());
    }

}
